package com.fearless.crm.workbench.service.impl;

import com.fearless.crm.workbench.dao.ClueRemarkDao;
import com.fearless.crm.workbench.entity.ClueRemark;
import com.fearless.crm.workbench.service.ClueRemarkService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ClueRemarkServiceImpl implements ClueRemarkService {


    @Resource
    private ClueRemarkDao clueRemarkDao;


//展现线索的备注，业务层方法
    public Map<String,Object> showClueRemarkService(String id) {
        Map map=new HashMap<>();
        List<ClueRemark> clueRemarks=clueRemarkDao.showClueRemarkDao(id);
        map.put("clueRemarks",clueRemarks);
        return map;
    }



//铺垫修改线索备注的模态窗口，业务层方法
    public ClueRemark editClueRemarkService(String id) {

        ClueRemark clueRemark=clueRemarkDao.editClueRemarkDao(id);
        return clueRemark;
    }



//执行修改线索备注的操作，业务层方法
    public boolean updateClueRemarkService(String noteContent, String id) {
        Map map=new HashMap();
        map.put("noteContent",noteContent);
        map.put("id",id);
        boolean flag=true;

        int count=clueRemarkDao.updateClueRemarkDao(map);
        if(count!=1){
            flag=false;
        }

        return flag;
    }



//执行线索备注的删除操作,业务层方法
    public boolean deleteClueRemarkService(String id) {
        boolean flag=true;

       int count=clueRemarkDao.deleteClueRemarkDao(id);

       if(count!=1){
           flag=false;
       }

        return flag;
    }


//执行线索备注的创建操作，业务层方法
    public boolean saveClueRemarkService(Map map) {
        boolean flag=true;
        int count=clueRemarkDao.saveClueRemarkDao(map);

        if(count!=1){
            flag=false;
        }

        return flag;
    }


}
